/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package web;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 *
 * @author nima0814
 */
@WebListener
public class SessionCountListener implements HttpSessionListener{
    
    private static int sessionCount = 0;

    public static int getSessionCount() {
        return sessionCount;
    }
    
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        sessionCount++;
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        sessionCount--;
    }
    
}
